package pe.gob.onpe.ejb;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import pe.gob.onpe.ejb.id.VotoId;


/**
 * Voto entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "VOTO", schema = "SVENP", uniqueConstraints = {})
public class Voto implements java.io.Serializable {


	private VotoId id;
	private ParticipacionListaCandidatos participacionListaCandidatos;
	
	private static final long serialVersionUID = 7812711608835394070L;
	// Constructors

	/** default constructor */
	public Voto() {
	}

	/** full constructor */
	public Voto(VotoId id,
			ParticipacionListaCandidatos participacionListaCandidatos) {
		this.id = id;
		this.participacionListaCandidatos = participacionListaCandidatos;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "procesoElectoralId", column = @Column(name = "PROCESO_ELECTORAL_ID", unique = false, nullable = false, insertable = true, updatable = true, precision = 10, scale = 0)),
			@AttributeOverride(name = "listacandidatospostulanteId", column = @Column(name = "LISTACANDIDATOSPOSTULANTE_ID", unique = false, nullable = false, insertable = true, updatable = true, precision = 10, scale = 0)),
			@AttributeOverride(name = "tipoEleccionId", column = @Column(name = "TIPO_ELECCION_ID", unique = false, nullable = false, insertable = true, updatable = true, precision = 10, scale = 0)),
			@AttributeOverride(name = "votoId", column = @Column(name = "VOTO_ID", unique = false, nullable = false, insertable = true, updatable = true)) })
	public VotoId getId() {
		return this.id;
	}

	public void setId(VotoId id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "PROCESO_ELECTORAL_ID", referencedColumnName = "PROCESO_ELECTORAL_ID", unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "LISTACANDIDATOSPOSTULANTE_ID", referencedColumnName = "LISTACANDIDATOSPOSTULANTE_ID", unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "TIPO_ELECCION_ID", referencedColumnName = "TIPO_ELECCION_ID", unique = false, nullable = false, insertable = false, updatable = false) })
	public ParticipacionListaCandidatos getParticipacionListaCandidatos() {
		return this.participacionListaCandidatos;
	}

	public void setParticipacionListaCandidatos(
			ParticipacionListaCandidatos participacionListaCandidatos) {
		this.participacionListaCandidatos = participacionListaCandidatos;
	}

}